package com.hqyj.smvc.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.hqyj.smvc.mapper.CardMapper;
import com.hqyj.smvc.pojo.Card;
import com.hqyj.smvc.service.CardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service
public class CardServiceImpl implements CardService {
    @Autowired
    private CardMapper cardMapper;

    /**
     * 查看所有身份证
     * @param pageNum 当前页数
     * @return 所有身份证
     */
    @Override
    @Transactional(propagation = Propagation.NOT_SUPPORTED)
    public List<Card> showAllCard(int pageNum){
        Page<Card> cardPage = PageHelper.startPage(pageNum, 5);
        List<Card> cards = cardMapper.selectAllCard();
        return cards;
    }
}
